import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

export default new Vuex.Store({
  plugins:[createPersistedState({
    reducer:(state)=>{
      return {
        moreobj:state.moreobj,
        worldobj:state.worldobj,
        userobj:state.userobj,
        city:state.city
      }
    }
  })],
  state: {
    moreobj: {},
    worldobj: {},
    userobj: {},
    city:'武汉'
  },
  getters: {
  },
  mutations: {
    giveToMore(state,item){
      state.moreobj = item
    },
    changeWorldObj(state,item){
      state.worldobj = item
    },
    changeUserObj(state,item){
      state.userobj = item
    },
    changeCity(state,item){
      state.city = item
    }
  },
  actions: {
  },
  modules: {
  }
})
